import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:wallet_utils/color.dart';
import 'package:wallet_utils/scan_view/scan_view.dart';

class ScanPage extends StatefulWidget {
  @override
  _ScanPageState createState() => _ScanPageState();
}

class _ScanPageState extends State<ScanPage> {
  @override
  Widget build(BuildContext context) {
    double offsetY = (ScreenUtil().screenHeight / 2 - 200).w;
    double size = 200.w;

    return Scaffold(
      appBar: AppBar(
        backgroundColor: ColorManager.color47000000,
        leading: IconButton(
            padding: EdgeInsets.only(left: 18.w),
            icon: Image.asset(
              'packages/hopson_utils/images/icon_back_black.png',
              width: 24.w,
              height: 24.w,
              color: Colors.white,
            ),
            onPressed: () {
              Get.back();
            }),
      ),
      body: Container(
        // color: Colors.red,
        child: HtScanView(
          key: scanGlobalKey,
          scanSize: size,
          offsetY: offsetY,
          resultback: (result) {
            Get.back(result: result.message);
          },
        ),
      ),
    );
  }
}
